package _0_语法._4_循环._3_多循环;

public class _99_求8加88加888的前十项的和 {

    public static void main(String[] args) {

        long sum = 0;   // 和
        long temp = 0;

        // 加几次
        for (int i = 0; i < 10; i++){
            System.out.println("第" + (i + 1) + "轮");
            // 每次加几个数
            for(int j = 0; j <= i; j++){
                temp = 0;
                // 每个数加几个8
                for(int x = 0; x <= j; x++){
                    temp = (long) (temp + 8 * Math.pow(10, x));
                }
                if(j != i) {
                    System.out.print(temp + "+");
                }
                else {
                    System.out.print(temp);
                }
            }
            sum = sum + temp;
            System.out.println("=" + sum);
        }
    }
}
